package my.ezbart;

import org.xmlvm.iphone.CGRect;
import org.xmlvm.iphone.UIImage;
import org.xmlvm.iphone.UIImageView;
import org.xmlvm.iphone.UIScrollView;
import org.xmlvm.iphone.UIViewController;

/**
 * @author Cecil Holmes
 * @version 0.1
 * 
 * SystemMap.java (2nd tab on the tab bar)
 * 
 * View Controller that displays a BART system map for the user's convenience.
 * 
 * Loads the BART map image into an Image View which is all added as a subview to a Scroll View.
 */
public class SystemMap extends UIViewController {
	
	UIImage bartMap = UIImage.imageNamed("BART_cc_map.png");
	UIImageView sm = new UIImageView();
	UIScrollView sv = new UIScrollView();

    public SystemMap() {
        /*
         * The title is used by the UITabBarController as the caption for
         * the tab.
         */
        this.setTitle("System Map");
        
        /*
         * The following statement associates an icon with the tab.
         */
        this.getTabBarItem().setImage(UIImage.imageNamed("103-map.png"));
    }
 
    @Override
    public void loadView() {

    	sm.setFrame(new CGRect(0, 0, bartMap.getSize().width, bartMap.getSize().height));
    	sm.setMultipleTouchEnabled(true);
    	sm.setUserInteractionEnabled(true);
    	sm.setImage(bartMap);

    	sv.setFrame(new CGRect(0,0, bartMap.getSize().width-1, bartMap.getSize().height-1));
    	sv.setScrollEnabled(true);
    	sv.setUserInteractionEnabled(true);
    	sv.setShowsVerticalScrollIndicator(true);
    	sv.setShowsHorizontalScrollIndicator(true);
    	sv.setContentSize(bartMap.getSize());
    	sv.addSubview(sm);
    	
    	this.setView(sv);
    }
}